<?php

namespace app\studentLayer\controller;

use think\Controller;
use think\Db;

class StudentLogin extends Controller
{

    public function Student_Login()
    {

        if ($this->request->isPost()) {

            $login = $this->request->post();
            $Get_Student = Db::table('s_student')->get($login);
//           var_dump($Select_Student);die;
            if ($Get_Student) {

                //var_dump(session('Student'));die;

                session('Student', $Get_Student);

                return redirect('/studentLayer/Student_Base/Student_Base');

            } else {
                return $this->error('登录失败', 'StudentLogin/Student_Login');
            }
        } else {

//            var_dump(1);die;
            return $this->fetch('/LoginView/Student_Login');
        }

    }


    public function Student_Out()
    {
        session('Student', null);
        //var_dump(1);die;
        return redirect('/studentLayer');
    }


}